package com.java.tutorials.jdk7.fileattribute;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.FileOwnerAttributeView;
import java.nio.file.attribute.UserPrincipal;
/**
 * Created by xuzhike on 2016/1/24.
 */
public class FileOwnerTest {
    public static void main(String[] args) throws Exception {
        Path path = Paths.get("e:/yjbWechat.txt");
        FileOwnerAttributeView view = Files.getFileAttributeView(path,
                FileOwnerAttributeView.class);
        UserPrincipal userPrincipal = view.getOwner();
        System.out.println(userPrincipal.getName());
    }
}
